package com.ocl.www.controller;

import com.ocl.www.domain.Tags;
import com.ocl.www.service.TagsService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by Administrator on 2016/11/25.
 */
@RestController
@RequestMapping("/tags")
public class TagsController {


    @Autowired
    private TagsService tagsService;

    private Map<String,Object> map = new HashMap();

    /**
     * 查询所有标签
     * @return
     */
    @ResponseBody
    @RequestMapping(value="/selectAllTags",method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value="查询所有Tag标签", notes="查询所有Tag标签")
    public Map<String,Object> selectAllTags(){

        try {
            map.put("taglist",tagsService.selectAllTags());
            map.put("info","s");
        } catch (Exception e) {

            map.put("tip",e.getMessage());
            map.put("info","e");
        }
        return map;

    }

}
